package com.zking.utils;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

import java.util.UUID;

public class EncryptUtils {

    public static String getEncryptStr(String args) {
        //1.shiro自带加密
        //String algorithmName, Object source, Object salt, int hashIterations
        //加密算法类型   加密内容   盐值  加密次数
        String source = args;
        String algorithmName = "SHA1";
        String saltStr = "69336e228cee46ce8d0b2db7ffa10035";
        ByteSource salt = ByteSource.Util.bytes(saltStr);
        int hashIterations = 256;
        SimpleHash simpleHash = new SimpleHash(algorithmName, source, salt, hashIterations);
        return simpleHash.toString();
    }

}
